#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    connect(ui->pushButton, &QPushButton::clicked, this, &Widget::handleClick);
    connect(ui->pushButton_2, &QPushButton::clicked, this, [this](){
        disconnect(ui->pushButton, &QPushButton::clicked, this, &Widget::handleClick);
        connect(ui->pushButton, &QPushButton::clicked, this, &Widget::close);
    });
}

void Widget::handleClick()
{
    this->setWindowTitle("modify the title of the window");
}

Widget::~Widget()
{
    delete ui;
}
